<template>
	<view>
		<!-- 顶部区域 -->
		<view class="top">
			<view class="status_bar"></view>
			<u-gap height="20"></u-gap>
			<view class="padding-lg flex-row justify-between align-center up">
				<view class="welcome">欢迎来到企大咖</view>
				<view class="icon-group" @click="$goto('/pages/other/location')">
					<view class="text">{{city.city?city.city:'郑州'}}</view>
					<image class="icon" src="../../static/images/home-address.png" style="width: 36rpx;" mode="widthFix"></image>
				</view>
			</view>

			<view class="padding-lr-lg flex-row justify-between align-center up">
				<view class="search flex-row justify-between align-center padding-lr-sm" @click="$goto('/pages/other/search')">
					<view class="text">请输入您的需求</view>
					<image class="icon" src="../../static/images/home-search.png" style="width: 26rpx;" mode="widthFix"></image>
				</view>
				<view class="icon-group" @click="$goto('/pages/other/kefu')">
					<view class="text">客服</view>
					<image class="icon" src="../../static/images/home-kefu.png" style="width: 36rpx;" mode="widthFix"></image>
				</view>
			</view>
			<view class="bg">
				<view class="mask"></view>
				<image class="bg" :src="$store.state.userinfo.index_banner || 'http://v2.qidka.com/storage/config/index_bg.png'"
				 style="width: 100%;height: 100%;"></image>
			</view>
		</view>
		
		<view class="bg-white">
			<grids v-model="scrollTop"></grids>
			
			<view style="margin-top: -40rpx; margin-bottom: -40rpx;">
				<kuaibao></kuaibao>
				<ads></ads>
			</view>
		</view>

		<list></list>
		<newuser v-model="isNew" @onmask="isNew=false"></newuser>
		
		<update @update="newusergift"></update>
		
		<my-need-login></my-need-login>
	</view>
</template>

<script>
	import store from '@/store.js'
	import grids from '@/pages/home/grids'
	import kuaibao from '@/pages/home/kuaibao'
	import ads from '@/pages/home/ads'
	import list from '@/pages/home/list'
	import newuser from '@/pages/home/newuser'
	import update from '@/pages/home/update'
	export default {
		components: {
			kuaibao,
			ads,
			grids,
			list,
			newuser,
			update
		},
		data() {
			return {
				scrollTop: 0,
				isNew: false
			};
		},
		onPageScroll(e) {
			this.scrollTop = e.scrollTop
		},
		computed: {
			city: state => store.state.city,
		},
		methods: {
			newusergift(e) {
				if (e) return;
				setTimeout(() => {
					if (this.$store.state.userinfo && this.$store.state.userinfo.new_reg_gift==0) {
						this.isNew = true
					}
				}, 3000)
			}
		}
	}
</script>

<style lang="scss">
	.top {
		width: 750rpx;
		height: 400rpx;
		position: relative;

		.up {
			position: relative;
			z-index: 3;
		}

		.bg {
			width: 100%;
			height: 100%;
			top: 0;
			left: 0;
			position: absolute;
			z-index: 1;

			.mask {
				width: 100%;
				height: 100%;
				position: relative;
				z-index: 2;
				background: rgba(0, 0, 0, 0.2);
			}
		}

		.welcome {
			font-size: 40rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: rgba(255, 255, 255, 1);
		}

		.search {
			width: 500rpx;
			height: 64rpx;
			background: rgba(255, 255, 255, 0.2);
			border-radius: 8rpx;

			.text {
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: rgba(255, 255, 255, 0.5);
			}
		}

		.icon-group {
			font-size: 24rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: rgba(255, 255, 255, 1);
			display: flex;
			align-items: center;

			.icon {
				margin-left: 8rpx;
			}
		}
	}
</style>